package com.easy.dn.ui.usercenter.activity;

import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.easy.common.base.BaseActivity;
import com.easy.dn.ui.usercenter.adapter.CountryListAdapter;

import java.util.ArrayList;
import java.util.List;

import butterknife.Bind;
import dn.easy.com.easyto.R;

public class CountryListActivity extends BaseActivity {


    @Bind(R.id.recyclerview)
    RecyclerView mRecyclerview;
    private List<String> mList = new ArrayList<>();
    private CountryListAdapter mAdapter;

    @Override
    public int getLayoutId() {
        return R.layout.activity_country_list;
    }

    @Override
    public void initPresenter() {

    }

    @Override
    public void initView() {

        mRecyclerview.setLayoutManager(new GridLayoutManager(this, 3));
        mList.add("1");
        mAdapter = new CountryListAdapter(R.layout.item_cuntry_list, mList);
        mRecyclerview.setAdapter(mAdapter);

        mAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
                if (mList.size() - 1 == position) {
                    mList.remove("1");
                    mList.add("dsf");
                    mList.add("1");
                    mAdapter.setNewData(mList);
                } else {

                }
            }
        });
    }

}
